<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateComPayWaysTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('com_payways'))
        {
            Schema::create('com_payways', function (Blueprint $table) {
                $table->string('id', 45)->primary()->comment('ID');
                $table->string('code', 45)->comment('代码');
                $table->string('name', 45)->comment('名称');
                $table->integer('fee_fixed')->nullable()->default(0)->comment('固定手续费');
                $table->integer('fee_percent')->nullable()->default(0)->comment('折扣手续费');
                $table->integer('min_pay')->nullable()->default(0)->comment('最小支付金额');
                $table->tinyInteger('is_platform')->nullable()->default(0)->comment('是否平台支付');
                $table->string('store_id', 45)->nullable()->comment('平台商户号');
                $table->tinyInteger('enabled')->nullable()->default(0)->comment('是否可用');
                $table->integer('sort')->default(0)->nullable()->comment('排序权重');
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('com_payways');
    }
}
